repo: handle GPG_ERR_AMBIGUOUS_NAME in sign_data
authorTobias Mueller <muelli@cryptobitch.de>
Sat, 5 May 2018 20:00:06 +0000 (22:00 +0200)
committerAtomic Bot <atomic-devel@projectatomic.io>
Sun, 6 May 2018 10:46:07 +0000 (10:46 +0000)
commit5ee78ea42a6dd2cb63e56652298350512fd56c7b
tree1a27ce30a3ad8521ef9f3e828c8ed0947b455b11
parent579faf92fd668082e63520cb4ba324754d2b00bd
repo: handle GPG_ERR_AMBIGUOUS_NAME in sign_data

This should give a more insightful error message if the user provides
a UID which is present on multiple keys.
This happens if you have an old key in your keyring which you are not
actively using any more, e.g. because it is too old.  You still have
your old keys in your keyring, because you want to read old email
encrypted for that key, though.

The gpgme function used by ostree right now complains if a UID is found
on multiple keys:
https://www.gnupg.org/documentation/manuals/gpgme/Listing-Keys.html#index-gpgme_005fget_005fkey
The used API is too simple for that use case.

Note that it would be nicer if ostree picked the only valid signing key out
of the available keys rather than using the simplistic gpgme_get_key
function.  It be nicer, of course, if there was such a gpgme function.

Closes: #1579
Approved by: cgwalters
src/libostree/ostree-repo.c